// src/api/api.js
import axios from '../config/axiosConfig';
//注册
export const register = (data:any={}) => {
    return axios.post('/auth/register', data);
}
// 登录
export const login = (data:any={}) => {
    return axios.post('/auth/login', data);
}
/**
 * 获取用户权限 getUserPermissions
 */
export const getUserPermissions = () => {
	return axios.get('/auth/permissions');
}
/**
 * 获取路由  routes
 */
export const getRoutes = (data:any={}) : Promise<any> => {
    return axios.get('/auth/routes', {
        params: data
    });
}

//创建图片分类
export const createCategoryApi = (data:any={}) : Promise<any> => {
    return axios.post('/upload/category', data);
}
// 获取图片分类
export const getCategoryApi = (data:any={}) : Promise<any> => {
    return axios.get('/upload/category', {
        params: data
    });
}
// 获取图片列表
export const getImagesApi = (data:any = { }) : Promise<any> => {
    return axios.get('/upload/list', {
        params: data
    });
}
/**
 * 删除图片分类
 */
export const deleteCategoryApi = (data:any = { }) : Promise<any> => {
    return axios.delete('/upload/category', {
        params: data
    });
}
/**
 * 获取管理员用户列表 adminList
 */
export const getRolesListApi = (data:any = { }) : Promise<any> => {
    return axios.get('/auth/adminList', {
        params: data
    });
}

/**
 * addAdmin 添加管理员
 */
export const addRoleApi = (data:any = { }) : Promise<any> => {
    return axios.post('/auth/addAdmin', data);
}
/**
 * 编辑管理员
 */
export const editRoleApi = (data:any = { }) : Promise<any> => {
    return axios.put('/auth/editAdmin', data);
}
/**
 * 删除管理员
 */
export const deleteRoleApi = (id:any) : Promise<any> => {
    return axios.delete(`/auth/deleteAdmin/${id}`);
}

/**
 * 获取用户列表 配置数据 config
 */
export const getUserConfigApi = (data:any = { }) : Promise<any> => {
    return axios.get('/user/config', {
        params: data
    });
}
/**
 * 获取用户列表
 */
export const getUsersListApi = (data:any = { }) : Promise<any> => {
    return axios.get('/user/list', {
        params: data
    });
}